<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">我的文章</a>
              <a>
                  <cite th:if="${code == 1001}">未审核</cite>
                  <cite th:if="${code == 1002}">已通过</cite>
                    <cite th:if="${code == 2002}">未通过</cite>
              </a>
                        </span>
                  <a class="layui-btn layui-btn-small" style="float: right;height: 30px;line-height: 30px;margin-top: 5px;" onclick="location.reload()" title="刷新">
                      <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
              </div>
              <div class="layui-fluid">
                  <div class="layui-row layui-col-space15">
                      <div class="layui-col-md12">
                          <div class="layui-card">
                              <div class="layui-card-body ">
                                  <form action="#" class="layui-form layui-col-space5" th:action="@{/draft/writer}" method="post">
                                                  <div class="layui-inline ">
                                                  <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.draftTitle}" name="draftTitle" placeholder="搜索稿件标题" id="draftTitle" />
                                                  </div>
                                                      <div class="layui-inline ">
                                                          <select id="draftType" name="draftType" th:if="${roleId == 6}">
                                                              <option value="" text="请选择">请选择稿件类型</option>
                                                              <option  th:selected="${searchInfo.draftType eq c.key}" th:if="${c.key <= 4}"
                                                                       th:each="c:${draftTypes}"  th:value="${c.key}" th:text="${c.value}">
                                                              </option>
                                                          </select>
                                                          <!--                            6队-->
<!--                                            <select  name="draftType" th:if="${roleId == 45}">-->
<!--                                                <option value="" text="请选择">请选择</option>-->
<!--                                                <option  th:selected="${searchInfo.draftType eq c.key}" th:if="${c.key > 4 && c.key <=6}"-->
<!--                                                         th:each="c:${draftTypes}"  th:value="${c.key}" th:text="${c.value}">-->
<!--                                                </option>-->
<!--                                            </select>-->
                                            <!--                            7队-->
<!--                                            <select  name="draftType" th:if="${roleId == 47}">-->
<!--                                                <option value="" text="请选择">请选择</option>-->
<!--                                                <option  th:selected="${searchInfo.draftType eq c.key}" th:if="${c.key > 6}"-->
<!--                                                         th:each="c:${draftTypes}"  th:value="${c.key}" th:text="${c.value}">-->
<!--                                                </option>-->
<!--                                            </select>-->
                                        </div>
                                    <div class="layui-inline "  style="display:none;">
                                        <input type="text"  name="box" th:value="${box}" id="box"/>
                                    </div>
<!--                                    <div class="layui-inline " th:if="${box}">-->
<!--                                        <select id="isPass" name="isPass">-->
<!--                                            <option value="" text="请选择">请选择审核状态</option>-->
<!--                                            <option  th:selected="${searchInfo.isPass eq c.key}"-->
<!--                                                     th:each="c:${draftCheckStatus}"  th:value="${c.key}" th:text="${c.value}"-->
<!--                                                     >${c.value}-->
<!--                                            </option>-->
<!--                                        </select>-->
<!--                                    </div>-->
                        <div class="layui-inline ">
                            <input type="text" class="layui-input timeSpace"  style="width: 400px;" placeholder="搜索稿件创建时间" name="createTimeSpace" th:value="${time}" />
                        </div>
                        <input type="hidden"  th:value="${searchInfo.statusCode}" name="statusCode">
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn  layui-btn-success radius"><i class="layui-icon">&#xe615;</i>
                            </button>
                        </div>
                        <div class="cl pd-5 bg-1 bk-gray " >
							<span class="l">
                                <div style="width: 120px;float: left" th:if="${pageInfo.total} gt '0'"><a href="javascript:;" th:if="${pageInfo.list[0].statusCode} eq '1'"
                                   onclick="deleteAll('/draft/draft/deleteAll')"
                                   class="layui-btn  layui-btn-danger radius"><i class="layui-icon">&#xe64d;</i> 批量删除</a></div>
<!--                                <input th:value="${searchInfo.statusCode}">-->
						<a href="javascript:;" th:if="${searchInfo.statusCode == 1001}"
                           onclick="layer_show('添加','/draft/writer/addBefore',900,500)"
                           class="layui-btn  layui-btn-normal radius"><i class="layui-icon">&#xe654;</i> 添加</a>
							</span>
                            <span class="r wei-height" style="float: right;margin-right: 20px">共有数据：<strong
                                        th:text="${pageInfo.total}"></strong> 条</span>
                        </div>
                        <div class="layui-card-body" style="text-align: center">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr class="text-c">
                                    <th width="25" style="display: none;"><input type="checkbox" name="" value="" lay-filter="checkall" lay-skin="primary"/></th>
                                    <th width="25">序号</th>
                                        <th width="40">稿件标题</th>
                                        <th width="40">稿件字数</th>
                                        <th width="40">稿件类型 </th>
                                        <th width="40">文件名 </th>
                                        <th width="40">创建时间</th>
                                        <th width="40">操作时间</th>
                                        <th width="40">重复率</th>
<!--                                        <th width="40">流程状态</th>-->
<!--                                        <th width="40">是否通过</th>-->

                                    <th width="40">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="text-c" th:if="${pageInfo.list.size() == 0}">
                                    <td colspan="15"><strong>暂无数据</strong></td>
                                </tr>
                                <tr class="text-c" th:each="draft,count:${pageInfo.list}">
                                    <td style="display: none;"><input type="checkbox" value="1" th:value="${draft.id}"
                                               name="id" lay-skin="primary"/></td>
                                    <td th:text="${count.count}"></td>
                                                <td th:text="${draft.draftTitle}"></td>
                                                <td th:text="${draft.draftNum}"></td>
                                                <td th:text="${draftTypes[draft.draftType]}"></td>
                                                <td th:text="${draft.fileName}"></td>
                                                <td th:text="${#temporals.format(draft.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                                <td th:text="${#temporals.format(draft.updateTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                                <td th:text="${draft.repetitiveRate}"></td>
<!--                                                <td th:text="${draft.statusCode}"></td>-->
<!--                                                <td th:text="${stateDic[draft.statusCode]}"></td>-->
<!--                                                <div  th:if="${draft.isPass} ne null"><td th:text="${draftCheckStatus[draft.isPass]}"></td></div>-->
<!--                                                <div th:if="${draft.isPass} eq null"><td>未审核</td></div>-->
                                    <td class="td-manage">

                                        <a title="编辑"  th:if="${draft.isPass ne 1 and draft.statusCode ne 1001}"
                                           th:onclick="'javascript:layer_show(\'编辑\',\'/draft/'+'writer'+'/editBefore/'+${draft.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe642;</i></a>
<!--                                        未审核-->
<!--                                        <a title="预览" th:if="${draft.isPass ne 0}"-->
<!--                                           th:onclick="'javascript:layer_show(\'预览\',\'/draft/'+'writer'+'/previewlist/'+${draft.id}+'\',900,500)'"-->
<!--                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe615;</i></a>-->
                                        <a title="预览" th:if="${draft.isPass ne 0}"
                                           th:onclick="'javascript:layer_show(\'预览\',\'/draft/'+'writer'+'/previewlist/'+${draft.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe615;</i></a>
<!--                                        互查记录 -->
<!--                                        <a title="预览" th:if="${draft.isPass eq 0 and isCheck eq true}"-->
<!--                                           th:onclick="'javascript:layer_show(\'预览\',\'/draft/'+'writer'+'/previewlist/'+${draft.id}+'?checkFlag=1001&reasonFlag=1001\',900,500)'"-->
<!--                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe615;</i></a>-->
                                        <a title="删除"  th:if="${draft.isPass ne 1 and draft.isPass ne 0 and draft.statusCode ne 1001}"
                                           th:onclick="'javascript:deleteById(\'/draft/'+'writer'+'/delete/'+${draft.id}+'\')'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe640;</i></a>
                                        <a title="操作记录" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'操作记录\',\'/admin/'+'draftLog'+'/operation/'+${draft.id}+'\',1000,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe60e;</i></a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:include="_pagination :: page"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>
<!--/_footer 作为公共模版分离出去-->
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({});
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });
    function showTxt(text)
    {
        var preHtml = UE.getEditor('editor').getContent(); <!-- execCommand( 'preview' );-->
        layer.open({
            title: '稿件预览',
            content: preHtml,
            btn: ['确定', '取消'],
            yes: function(index, layero){//两个参数:当前层索引,当前层DOM对象
                //按钮【确认】的回调
            },
            btn2: function(index, layero){
                //按钮【取消】的回调
                //return false 开启该代码可禁止点击该按钮关闭
            },
        });
    };

</script>
</body>
</html>